package controller;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.FileNotFoundException;
import java.util.Observable;

import javax.swing.Timer;

import model.*;

import view.froggerView;


public class logController  {
	private froggerView view;
	private gameModelI model;
	Timer time = new Timer(20, new ActionListener() {

		@Override
		public void actionPerformed(ActionEvent arg0) {
			for(int i=0;i<25;i++){
				model.getLogs().get(i).move(0.1);
				}
				view.repaint();
		}} );
	
	public logController() {
		try {
			model = new gameModel();
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			view = new froggerView(model);
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		time.start();
	}
	
}
	
	
//	public void actionPerformed(ActionEvent arg0) {
//		time = new Timer(20,this);
//		time.start();
//		
//		for(int i=0;i<25;i++){
//		model.getLogs().get(i).move(10);
//		}
//		view.repaint();
//	}
//
//
//}
//	public enum State{MOVE};
//	private State state = State.MOVE;
//	private gameModelI model;
//	private AnimatnActionI action;
//	private Timer timer;
//	
//	public logController(gameModelI model){
//		this.model = model;
//		timer = new Timer(20, new ActionListener(){
//			@Override public void actionPerformed(ActionEvent e){
//				tick();}});
//			}
//
//	protected void tick() {
//		switch(state){
//		case MOVE: action.tick();
//		if(action.getState() == AnimatnActionState.MOVE){
//			timer.start();
//			setChanged(); notifyObservers();
//			
//		}
//	}
//		}
//	public State getState(){return state;}
//	